package CB_C19;

import javafx.scene.control.*;
import javafx.stage.Alert.*;

import javafx.scene.CustomNode;
import javafx.scene.Group;
import javafx.scene.Node;
import javax.media.Time;

/**Play Button: play or pause the video*/
public var play : Button;
/**Progressbar: indicates the current duration value of media*/
public var timeline : ProgressBar;
/**duration: holds the current duration value of media*/
public var duration_var : Time;

/**Play_Timeline
 * Created on 10.11.2009. <br>
 <br>
 Represents the Play Button and Progressbar
 *<br>
 * @author Sebastian Czekierski, Stefan Blumberger
 *
 *
 */

public class gui_Play_Timeline extends CustomNode
{
    /**holds duration in seconds*/
    public var millis = 0;
    /**holds duration in milliseconds*/
  
    override function create(): Node
    {
        return Group
        {
            content:
            [
                play = Button
                {
                    translateX: 0;
                    translateY: 5;
                    width : 60;
                    height : 25;
                    text: "Play";
                    disable: true;
                    action: function(): Void
                    {
                            if(play.text.equals("Play"))
                            {
                                Main.comp = Main.p.getVisualComponent();
                                Main.p.playerstart();
                                play.text = "Pause";
                                Main.class_brightness.checkBox.disable = true;
                                Main.class_brightness.brightness_text.visible = false;
                                Main.class_open_save.save.disable = true;
                            }else
                            {
                                Main.p.playerstop();
                                play.text = "Play";
                            }
                     }
                }
	   	Label
                {
                    translateX: play.translateX+play.width+10;
                    translateY: 10;
                    text: bind "duration: {duration_var.getSeconds() as Integer}";
                    width: 120;
                }
            ]
        }
    }
}
